// 群组公告
(function () {
  if (/^\/group\/notice/.test(location.pathname) === false) {
    return false;
  }

  $(document).on('click', 'footer .button', function () {
    var button = $(this);
    Modal.confirm({
      message: '你确定要删除这条公告吗？',
      callback: function () {
        button.prop('disabled', true).html('处理中');
        $.post('/group/ajax/notice', {
          id: location.pathname.split('/')[3]
        }).then(function (res) {
          if (res.code === 200) {
            notice('公告删除成功');
            ClientBridge.close();
            ClientBridge.deleteNotice(location.pathname.split('/')[3]);
          }
          else {
            notice(res.data.message);
          }
          button.prop('disabled', false).html('删除公告');
        });
      }
    });
  });
})();
